<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="common/head :: head"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content" style="width: 98%;">
            <form id="ec" th:action="@{/admin/save}" method="post" class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-2 control-label">真实姓名：</label>
                    <div class="col-sm-10">
                        <input type="text" name="name" id="name" value="" class="form-control"/>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">用户账号：</label>
                    <div class="col-sm-10">
                        <input type="text" name="username" id="username" value="" class="form-control"/>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">手机号码：</label>
                    <div class="col-sm-10">
                        <input type="text" name="phone" id="phone" class="form-control" maxlength="11" ></input>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">密码：</label>
                    <div class="col-sm-10">
                        <input type="text" name="password" id="password" class="form-control" maxlength="11" ></input>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">确认密码：</label>
                    <div class="col-sm-10">
                        <input type="text" name="confirmPassword" id="confirmPassword" class="form-control" maxlength="11" ></input>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">描述：</label>
                    <div class="col-sm-10">
                        <textarea name="description" id="description" class="form-control" style="width:100%;height: 50px;" ></textarea>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group posf">
                    <div class="col-sm-4 col-sm-offset-2 text-right">
                        <button class="btn btn-primary" type="submit">确定</button>
                        <button class="btn btn-white" type="button" value="取消" onclick="opt.closeWin()">取消</button></div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script>
    $(function () {
        $('#ec').validate({
            rules:{
                name: "required",
                username: {
                    required:true,
                    rangelength:[2,10]
                },
                phone: {
                    required: true,
                    isPhone:true
                },
                password: {
                    required: true,
                    rangelength: [6,15]
                },
                confirmPassword: {
                    equalTo: "#password"
                },
                description: "required"
            },
            messages: {
                name: "真实姓名必须输入",
                username: {
                    required: "用户名必须输入",
                    rangelength: "用户名3到15位"
                },
                phone: {
                    required: "手机号码必须输入",
                    isPhone: "手机号码格式不正确"
                },
                password: {
                    required: "密码必须输入",
                    rangelength: "密码6到15位"
                },
                confirmPassword: {
                    equalTo: "两次输入的密码不一致,请重新输入"
                },
                description: "用户描述必须输入"
            },
            submitHandler: function (form) {
                $(form).find(":submit").attr("disabled", "true").text("正在提交...");
                form.submit();
            }
        });
    });
</script>
</html>